package fr.imag.m2pgi.m2m.geoloc.mqtt.subscriber;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class Activator implements BundleActivator {

  private ServiceRegistration<SubscribeService> service;
  SubscribeService sub;
  
  public void start(BundleContext context) throws Exception {
    System.out.println("Starting Subscriber bundle...");
    //TODO: get property
    String server = "127.0.0.1";
    String port = "1883";
    sub = new Subscriber();
    service = context.registerService(SubscribeService.class, sub, null);
    System.out.println("Subscriber service registered.");    
  }

  public void stop(BundleContext context) throws Exception {
    //sub.disconnect();
    service.unregister();
  }
  
}
